package CommonInterface;

public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("张三",17);
        Student student2 = new Student("李四",18);

        if (student1.compareTo(student2)>0){
            System.out.println("student1>student2");
        }else if (student1.compareTo(student2)==0){
            System.out.println("student1=student2");
        }else {
            System.out.println("student1<student2");
        }

        /*String str1 = "王五";
        String str2 = "李四";
        //谁调用就是谁去和参数比较
        if (str1.compareTo(str2)>0){
            System.out.println(str1+">"+str2);
        }else if (str1.compareTo(str2)==0){
            System.out.println(str1+"="+str2);
        }else {
            System.out.println(str1+"<"+str2);
        }*/
    }
}
